const os = require("os");
// 查看本地IP地址
function getLocalIP() {
  const ifaces = os.networkInterfaces(); // 网络信息
  let ip = "";
  for (let dev in ifaces) {
    const iface = ifaces[dev];
    for (let j = 0; j < iface.length; j++) {
      const item = iface[j];
      if (item.family === "IPv4" && !item.internal) {
        ip = item.address;
        break;
      }
    }
    if(ip) {
      break;
    }
  }
  console.log('IP::', ip);
  return ip;
}
module.exports = {
  session: {
    redis: {
      db: 0,
      port: 6379,
      password: "***",
      host: "127.0.0.1",
    },
  },
  db: {
    mysql: {
      // 多库连接
      clients: {
        foindia: {
          password: "***",
          host: "127.0.0.1",
        },
        user: {
          password: "***",
          host: "127.0.0.1",
        },
      },
    },
  },
  api: {
    host: `http://${getLocalIP()}:8086`,
    prefix: "/",
    v1: "/v1/",
  },
  alipay: {
    notifyUrl: "http://6wl656550.zicp.vip:8086/alipay",
  },
  wxpay: {
    notifyUrl: "http://6wl656550.zicp.vip:8086/wechatpay",
  }
};
